package xishuiwanglearning.aoplearning;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

//增强的类
@Component
@Aspect//生成代理对象
public class Userpro {
    //前置通知
    @Before(value = " execution(* xishuiwanglearning.aoplearning.User.add())")
    public void before(){
        System.out.println("before..........");
    }


    //后置通知
    @After(value = " execution(* xishuiwanglearning.aoplearning.User.add())")
    public void after(){
        System.out.println("after..........");
    }

    //环绕通知
    @Around(value = " execution(* xishuiwanglearning.aoplearning.User.add())")
    public void around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{

        System.out.println("befor around...........");

        //被增强的方法
        proceedingJoinPoint.proceed();

        System.out.println("after around...........");
    }


}
